3.9 Python Program Demo

  • Demo 1: Control Magician Lite to draw a square
    #Starting point
    from DobotEDU import *
    x = 250
    y = 0
    z = -47 
    #Control the robot end to move to the starting point in Jump mode
    m_lite.set_ptpcmd(0, x, y, z, 0)
    side = 30  #side length of square
    m_lite.set_ptpcmd(1, x+side, y, z, 0)
    m_lite.set_ptpcmd(1, x+side, y-side, z, 0)
    m_lite.set_ptpcmd(1, x, y-side, z, 0)
    m_lite.set_ptpcmd(1, x, y, z, 0)
    
  • Demo 2: Control the end suction cup of Magician Lite to move the block from point A (257, -143, -38) to point B (257, -143, -38).
#Initialize the robot
from DobotEDU import *
m_lite.set_ptpcmd(0, 250, 0, 50, 0)  #Starting point of robot

m_lite.set_ptpcmd(0, 257, -143, -38, 0)  #The robot moves to point A
m_lite.set_endeffector_suctioncup(True, True)  #Suck the block
m_lite.set_ptpcmd(0, 272, 57, -38, 0)  #The robot moves to point B
m_lite.set_endeffector_suctioncup(True, False)  #Release the block
m_lite.set_ptpcmd(0, 250, 0, 50, 0)  #The robot returns to the initial point
m_lite.set_endeffector_suctioncup(False, False)  #Close suction cup

results matching ""

    No results matching ""